<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:body>
        <ui:composition template="../communityTemplate.xhtml">
            <ui:define name="content">

                <p:panel header="UserInformation" toggleable="true">  
                    <h:form id="profile">
                        <h:panelGrid columns="2" cellpadding="5">  
                            <h:outputText value="Email :"/>
                            <h:outputText value="#{viewUserBean.selected.email}"/>  
                            
                            <h:outputText value="Name :"/>
                            <h:outputText value="#{viewUserBean.selected.name}"/>
                        </h:panelGrid>
                    </h:form>
                </p:panel>

                <p:panel header="Interest" toggleable="true">
                    <h:form id="interest">
                        <p:dataList value="#{viewUserBean.interests}" var="interest">
                        #{interest.name}, 
                    </p:dataList>
                    </h:form> 
                </p:panel>
                
                <p:panel header="Status Updates" toggleable="true">
                    <h:form id="updates">
                        <p:dataTable id="dStatus" var="update" value="#{viewUserBean.statusUpdates}"
                                     paginator="true" rows="20"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                     rowsPerPageTemplate="20,50,100">

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Update"/>
                                </f:facet>
                                <h:outputText value="#{update.update}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Time updated"/>
                                </f:facet>
                                <h:outputText value="#{update.timeupdated}"/>
                            </p:column>

                        </p:dataTable>
                        <p:poll interval="5" update="dStatus" widgetVar="poll" autoStart="true"/>
                    </h:form>
                </p:panel>

            </ui:define>
        </ui:composition> 
    </h:body>
</html>

